Why and how to use SQL DISTINCT Clause?
1518
30-Sep-2016
Updated on 14-Sep-2020
Abhishek Srivasatava
30-Sep-2016Distinct is used when unique result is needed from user side. It is used because after joining many tables there is chance of multiple rows for single data may come.
For example
Prsn table holding the Adhar number of person.
And we join this prsn table with prsn_buy_prod table. Let person buy 3 product so three rows will exist.
Program without distinct:
But if use distinct along with select statement in the above program then single record will come.